<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    @include('public.h5_head')
    <title>个人中心</title>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/rem.js"></script>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/common.css"/>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/personal.css?v=1.0.2"/>
</head>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/iscroll.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/app.js"></script>
{{--<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>--}}
<script>
    var openid = '{{ env('WECHAT_APPID') }}';
    var domain_name = '{{ env('DOMAIN_NAME') }}';
    @if(!Auth::check())
    window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+openid+"&redirect_uri=https%3A%2F%2F"+domain_name+"%2FwechatLogin%3Fproduc_id%3D0&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
    @endif
</script>

<style>
    .wechat_buyers{
        cursor: pointer;
    }
</style>
<body onload="loaded()">
<div id="personal">
    <div class="wrap">
        <div class="person_main">
            <div class="personal_t">
                <img class="bg_blur" src="img/bg-p.jpg"/>
                <div class="coverage">
                    <div class="coverage1"></div>
                    <div class="coverage2"></div>
                    <div class="coverage3"></div>
                    <div class="personal_img">
                        @if(Auth::user()->id == 0)
                            <img src="/img/head1x.png" alt="" />
                        @else
                            <img src="{{ Auth::user()->face }}" alt="" />
                        @endif
                    </div>
                </div>
                <div class="total">
                    <div class="integral">
                        <p class="integral_sum">{{ Auth::user()->integral }}</p>
                        <img src="img/money.png"/>
                    </div>
                    {{--<div class="postage">--}}
                        {{--<img src="img/postage.png"/>--}}
                        {{--<p class="postage_sum">{{ Auth::user()->postage_bean }}</p>--}}
                    {{--</div>--}}
                    <div class="grade">
                        <img src="img/top.png"/>
                        <p class="grade_sum">{{ $info['ranking'] }}</p>
                    </div>
                </div>
            </div>
            <div class="personal_pic">
                <div class="pic1 picture" onclick="window.location.href='/UserCenter/pendingPayment'">
                    <img src="/img/00021.png" alt="" />
                    <span>购物车</span>
                    @if($info['penpay'] > 0)
                    <div class="personal_num">
                        <p class="quan">{{ $info['penpay'] }}</p>
                    </div>
                    @endif
                </div>
                {{--<div class="pic4 picture" onclick="window.location.href='/user/onCreditList'">--}}
                    {{--<img src="/img/00017.png" alt="" />--}}
                    {{--<span>赊账款</span>--}}
                    {{--@if( $info['onCredit'] > 0)--}}
                    {{--<div class="personal_num">--}}
                        {{--<p class="quan">{{ $info['onCredit'] }}</p>--}}
                    {{--</div>--}}
                    {{--@endif--}}
                {{--</div>--}}
                <div class="pic2 picture" onclick="getUserRecGoods()">
                    <img src="/img/00019.png" alt=""/>
                    <span>待收货</span>
                    @if( $info['recgoods'] > 0)
                    <div class="personal_num">
                        <p class="quan">{{ $info['recgoods'] }}</p>
                    </div>
                    @endif
                </div>
                <div class="pic3 picture" onclick="window.location.href='/UserCenter/isComplete'">
                    <img src="/img/00020.png" alt="" />
                    <span>已完成</span>
                    @if( $info['complete'] > 0)
                        <div class="personal_num">
                            <p class="quan">{{ $info['complete'] }}</p>
                        </div>
                    @endif
                </div>
            </div>
            <div class="personal_b1 footer" onclick="window.location.href='/productLists'">
                <p class="footer_p1">在售商品</p>
                <span class="footer_sp"><img src="/img/youjiantou.png" alt="" /></span>
            </div>
            <div class="personal_b4 footer" onclick="window.location.href='/userOrderList'">
                <p class="footer_p1">我的订单</p>
                <span class="footer_sp"><img src="/img/youjiantou.png" alt="" /></span>
            </div>
             <div class="personal_b4 footer" onclick="window.location.href='/user/selectOrders'">
                <p class="footer_p1">订单查询</p>
                <span class="footer_sp"><img src="/img/youjiantou.png" alt="" /></span>
            </div>
            @if($info['exchange'])
            <div class="personal_b4 footer" onclick="window.location.href='/customer/goods-storage'">
                <p class="footer_p1 bg_on">调货小工具</p>
                <span class="footer_sp"><img src="/img/youjiantou.png" alt="" /></span>
            </div>
            @endif
            <!-- <div class="personal_b4 footer" onclick="window.location.href='/user/lastWeekRanking'">
                <p class="footer_p1">排行榜</p>
                <span class="footer_sp"><img src="/img/youjiantou.png" alt="" /></span>
            </div> -->
            <div class="personal_b4 footer">
                <p class="footer_p2">微信绑定</p>
                @if($info['openid'])
                    <p class="footer_p3">已绑定</p>
                    @else
                    <p class="footer_p3 wechat_buyers" onclick="boundWechat()">未绑定</p>
                @endif
            </div>
        </div>
    </div>
</div>
</body>
<script>
    {{--wx.config({--}}
        {{--debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。--}}
        {{--appId: '{{ $info['appId'] }}', // 必填，公众号的唯一标识--}}
        {{--timestamp: '{{ $info['timestamp'] }}', // 必填，生成签名的时间戳--}}
        {{--nonceStr: '{{ $info['nonceStr'] }}', // 必填，生成签名的随机串--}}
        {{--signature: '{{ $info['signature'] }}',// 必填，签名，见附录1--}}
        {{--jsApiList: ['chooseImage','scanQRCode','openLocation'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2--}}
    {{--});--}}

//    wx.ready(function(){
//        wx.checkJsApi({
//            jsApiList: ['chooseImage','scanQRCode','openLocation'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
//            success: function(res) {
////                console.log(res)
//                // 以键值对的形式返回，可用的api值true，不可用为false
//                // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
//            }
//        });
//        document.querySelector('#scanQRCode').onclick = function() {
//            wx.scanQRCode({
//                needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
//                scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
//                success: function (res) {
//                    var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
//                }
//            });
//        };
//    });

//    wx.error(function(res){
//        alert('验证失败')
//    });

    function getUserRecGoods() {
        window.location.href = '/UserCenter/getUserRecGoods'
    }

    function boundWechat() {
//        window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+openid+"&redirect_uri=https%3A%2F%2Fwww.52mylife.cn%2Fuser%2FboundWechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
        window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+openid+"&redirect_uri=https%3A%2F%2F"+domain_name+"%2Fuser%2FboundWechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";

    }
    /*滚动*/
    var myScroll;
    function loaded () {
        setTimeout(function(){
            myScroll = new IScroll('.wrap', {
                mouseWheel: true,
                click: true
            });
        },100);
    }
    document.addEventListener('touchmove', function (e) {e.preventDefault();},false);
</script>
</html>
